import yara

# 定义 YARA 规则
rule = """
rule HelloYara {
    strings:
        $hello = "Hello YARA"
    condition:
        $hello
}
"""

# 编译规则
rules = yara.compile(source=rule)

# 匹配内容
matches = rules.match(data="This is a test: Hello YARA inside.")
print(matches)
